//
//  Marcos.swift
//  Simple Switf Project
//
//  Created by 陈卫东 on 2017/1/13.
//  Copyright © 2017年 陈卫东. All rights reserved.
//

import UIKit

func BBLog<T>(message: T) {
    #if DEBUG
        print("\(message)")
    #endif
}


//Frame
let ScreenWidth = UIScreen.main.bounds.width
let ScreenHeight = UIScreen.main.bounds.height
let ScreenScale = UIScreen.main.scale
let ScreenRatio = ScreenWidth / 320.0
let OnePixelLineWidth = 1.0 / ScreenScale
let IS_IPHONEX = (ScreenHeight == 812)//iPhone X
let StatusBarHeight = (IS_IPHONEX ? 44 : 20)
let MarginBottom = (IS_IPHONEX ? 34 : 0)
let NavHeight = (IS_IPHONEX ? 88 : 64)

func kRatio(number: CGFloat) -> CGFloat {
    return number * ScreenRatio
}

//system version
func iOS(version: Float) -> Bool {
    return (UIDevice.current.systemVersion as NSString!).floatValue >= version
}

//Color
func RGB(R: CGFloat, G: CGFloat, B: CGFloat) -> UIColor {
    return UIColor.init(red: R / 255.0, green: G / 255.0, blue: B / 255.0, alpha: 1.0)
}

func RGBA(R: CGFloat, G: CGFloat, B: CGFloat, A: CGFloat) -> UIColor {
    return UIColor.init(red: R / 255.0, green: G / 255.0, blue: B / 255.0, alpha: A)
}

func HEXColor(ofColor color: UInt16) -> UIColor {
    return UIColor.init(red: CGFloat(Double((color>>16)&0xFF)/255), green: CGFloat(Double((color>>8)&0xFF)/255), blue: CGFloat(Double(color&0xFF)/255), alpha: 1.0)
}

let Nav_BG_Color = UIColor.HexColor(hex: "0x539DDB")
let App_BG_Color = UIColor.HexColor(hex: "0xF6F6F6")
let App_Line_Color = UIColor.HexColor(hex: "0xF2F2F2")
let Normal_Text_Color = UIColor.HexColor(hex: "0x989898")
let Import_Text_Color = UIColor.HexColor(hex: "0x333333")
let Hlight_Text_Color = UIColor.HexColor(hex: "0xF0F0F0")

//others
//func Format(string: CGFloat, args) -> NSString {
//    return NSString.init(format: string, ...)
//}

func Font(font: CGFloat) -> UIFont {
    return UIFont.systemFont(ofSize: font)
}

func BoldFont(font: CGFloat) -> UIFont {
    return UIFont.boldSystemFont(ofSize: font)
}

func kImgName(ofName name: NSString) -> UIImage {
    return UIImage.init(named: name as String)!
}



